@extends('admin.layout.main')
@section('content')
    <style type="text/css">
      .left-filter{margin-left:8px;}
    </style>
    <section class="content-header">
      <h1>
        群管理
      </h1>
      <ol class="breadcrumb">
        <li><a href="javascript:void(0)"><i class="fa fa-dashboard"></i> 微信群管理</a></li>
      </ol>
    </section>
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <div class="row">
            <div class="col-lg-12 col-xs-6">
                <div class="box">
                    <div class="box-header with-border">
                        <div class="row">
                            <div class="col-sm-10">
                                <a class="add_group" type="button" href="javascript:void(0)"><i class="fa fa-fw fa-plus"></i>新增微信群</a>
                            </div>
                        </div> 
                    </div>
                    
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-hover" id="user-list">
                            <div class="dataTables_filter">
                                <form action="/admin/wx_helper/index" method="GET">
                                    <button type="submit" class="btn btn-info btn-sm">查询:</button><input type="search" placeholder="请输入关键字" name="keywords" class="form-control input-sm" value="">
                                </form>
                            </div>
                            <thead>
                                <tr>
                                    <th style="width: 50px"><a style="cursor:pointer" class="all_check">全选</a></th>
                                    <th>微信群编码</th>
                                    <th>机器助手</th>
                                    <th>群主</th>
                                    <th>群状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>    
                            <tbody> 
                                @foreach($groups as $group)
                                    <tr id="{{$group->id}}">
                                        <td><input type="checkbox" name="checkbox_member" class="checkbox_member" user-id="{{$group->id}}"></td>
                                        <td>{{$group->group_token}}</td>
                                        <td>{{$group->robot}}</td>
                                        <td>{{$group->master_name}}</td>
                                        <td>@if($group->status == 1) 活跃 @endif</td>
                                        <td>
                                            <a href="javascript:void(0)" class="group-edit">编辑</a>
                                        </td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                        {{$groups->links()}}
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- datepicker -->
    <script src="{{asset('/adminlte/plugins/datepicker/bootstrap-datepicker.js')}}"></script>
    <script type="text/javascript">
        $(function () {
            $('#user-list').DataTable({
              "paging": false,
              "lengthChange": false,
              "searching": false,
              "info": false,
              "autoWidth": true,
              "columns": [
                {"orderable": false},
                {"orderable": false},
                {"orderable": true},
                {"orderable": true},
                {"orderable": true},
                {"orderable": false}
              ]
            });
        });

        $('.all_check').click(function(){
            $('.checkbox_member').click();
        });

        $('#datepicker').datepicker({
          autoclose: true,
          endDate: new Date()
        });

        $('.add_group').click(function(){
            dialog_from('/admin/wx_helper/add_group', '新增微信群');
        });

    </script>
@endsection      